package com.sqy.controller;


import com.sqy.entity.Icons;
import com.sqy.entity.Recommend;
import com.sqy.exception.ImoocMallExceptionEnum;
import com.sqy.service.RecommendService;
import com.sqy.utlis.ApiResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/Recommend")
@Api(tags = "爆款推荐")
public class RecommendController {
    @Autowired
    RecommendService recommendService;


    @PostMapping("/add")
    @ApiOperation("添加爆款图片")
    public ApiResult addIcons(@RequestBody Recommend recommend){

        boolean save = recommendService.save(recommend);

        if(save){
            return  ApiResult.success();
        }
        return  ApiResult.error(ImoocMallExceptionEnum.ADD_FAIL);
    }

}
